﻿using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using CommunityToolkitMvvmDemo.Common;
using CommunityToolkitMvvmDemo.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Xml.Linq;

namespace CommunityToolkitMvvmDemo.ViewModels
{
   public partial   class LoginViewModel:ObservableObject
    {

        [RelayCommand]
        void Close() => Application.Current.Shutdown();
    

        [RelayCommand]
        void Move(object win) => (win as Window).DragMove();
    
        [RelayCommand]
        void Login(object o)
        {
            GlobalValues.UserInfo = new Person()
            {
                Id = 1,
                Name = "xcz",
                Mail = "jsyzxcz@163.com",
                LogoUrl = "/Assets/Images/room1.jpg"
            };

            Application.Current.Dispatcher.Invoke(new Action(() =>
            {
                (o as Window).DialogResult = true;
            }));
        }



        [ObservableProperty]
        public string name = "";

        [ObservableProperty]
        public string password = "";

    }
}
